Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abort a request if the user is not found #95

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AstraLuma
Copy link

This is probably totally the wrong thing to do. But it seems better than throwing 500's?

@rowanlupton
Copy link
Owner

Ooh, good point. I'm feeling torn right now about whether the find_user function should do the abort, or whether everything implementing find_user should try catch -- I'm not super fond of side effects where I can avoid them, y'know?

I think that I want to stick with find_user always returning a user-type-thing, whether that's the user object or None (or potentially some other option), but I'm definitely open to changing my mind on that

@AstraLuma
Copy link
Author

Well, this was a quick hack, and I can certainly see cases where you want to look up a user and handle it differently.

@AstraLuma
Copy link
Author

I will say that some ORMs handle it by raising an exception (eg, Django's ORM raises an ObjectDoesNotExist)

@rowanlupton
Copy link
Owner

yeah i hear you! i think that an exception is probably the way to go? i'll mull it over some more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants